<!DOCTYPE html>
<html>
<head>
    <meta content="text/html;charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="Cache-Control" content="no cache"/>
    <meta http-equiv="Expires" content="0"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=no"/>
    <script src="https://cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
    <link href="https://cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" type="text/css" href="../../css/fs.css" media="all"/>
    <script type="text/javascript" src="../../plugins/layui/layui.js"></script>
    <script type="text/javascript" src="../../plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="../../plugins/tinymce/tinymce.min.js"></script>
    <script type="text/javascript" src="../../plugins/tinymce/jquery.tinymce.min.js"></script>
    <link rel="stylesheet" href="../../plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
    <script type="text/javascript" src="../../plugins/ztree/js/jquery.ztree.all.min.js"></script>
    <script type="text/javascript" src="../../plugins/frame/js/fsDict.js?v=1.5.0"></script>
    <script type="text/javascript" src="../../plugins/frame/js/fs.js?v=1.5.0"></script>
    <script type="text/javascript" src="../../plugins/frame/js/frame.js?v=1.5.0"></script>
    <script type="text/javascript" src="../../scripts/basic.js"></script>

</head>
<body>
<div class="layui-fluid">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-inline">
                <input type="radio" lay-filter="filter" name="type" value="user" title="按用户" checked="checked">
                <input type="radio" lay-filter="filter" name="type" value="role" title="按角色">
            </div>
            <input type="hidden" id="processId" name="processId" autocomplete="off" class="layui-input"/>
            <input type="hidden" id="nodeId" name="nodeId" autocomplete="off" class="layui-input"/>
            <input type="hidden" id="setType" name="setType" autocomplete="off" class="layui-input" value="user"/>
        </div>
        <hr/>
    </form>
    <div id="byUser">
        <div>
            <button class="layui-btn" function="submit" funcNo="act/node/user" isSelect="1" isConfirm="1" isMutiDml="0"
                    isClose="1" tableId="fsDatagrid" inputs="nodeUser:$username,processId:#processId,nodeId:#nodeId,type:#setType">
                <i class="layui-icon">&#xe631;</i>保存
            </button>
            <button class="layui-btn" function="refresh">
                <i class="layui-icon">&#x1002;</i>刷新
            </button>
        </div>

        <table id="fsDatagrid" class="fsDatagrid" lay-filter="fsDatagrid" funcNo="sys/user/list" isPage="1"
               pageSize="10" defaultForm="query_form">
        </table>

        <div class="fsDatagridCols">
            <p type="numbers" title="#"/>
            <p checkbox="true"/>
            <p field="username" title="登录名" width="100" sort="true"/>
            <p field="cname" title="姓名" width="150"/>
        </div>
    </div>
    <div id="byRole" style="display:none;">
        <div>
            <button class="layui-btn" function="submit" funcNo="act/node/user" isSelect="1" isConfirm="1" isMutiDml="0"
                    isClose="1"  tableId="fsDatagrid2" inputs="nodeRole:$roleNum,processId:#processId,nodeId:#nodeId,type:#setType">
                <i class="layui-icon">&#xe631;</i>保存
            </button>
            <button class="layui-btn" function="refresh">
                <i class="layui-icon">&#x1002;</i>刷新
            </button>
        </div>
        <table id="fsDatagrid2" class="fsDatagrid" lay-filter="fsDatagrid2" funcNo="sys/role/list" isPage="1"
               pageSize="10" defaultForm="query_form">
        </table>

        <div class="fsDatagridCols">
            <p type="numbers" title="#"/>
            <p checkbox="false"/>
            <p field="roleNum" title="角色编码" width="100" sort="true"/>
            <p field="roleName" title="角色名称" width="150"/>
        </div>
    </div>
</div>
<script>
    layui.use('form', function () {
        var form = layui.form;

        form.on('radio(filter)', function (data) {
            if (data.value == "user") {
                $("#byRole")[0].style.display = 'none';
                $("#byUser")[0].style.display = 'block';
                $("#setType").val(data.value);
            } else if (data.value == "role") {
                $("#byUser")[0].style.display = 'none';
                $("#byRole")[0].style.display = 'block';
                $("#setType").val(data.value);
            }
        });
    });
</script>
</body>
</html>
